package code;

import org.junit.jupiter.api.Test;

import java.util.ArrayList;
import java.util.Arrays;

/**
 * @author moso
 * @Date 2025/6/17 19:39
 */

public class BN {
    /**
     * abcde  ->edcba
     */
    public String resever(String string){
        char[] chars = string.toCharArray();
        int n = string.length();
        StringBuffer stringBuffer = new StringBuffer();
        for (int i=n-1; i>=0; i--){
            stringBuffer.append(chars[i]);
        }
        String res = stringBuffer.toString();
        return res;
    }

    @Test
    void  testStr(){
        String s = "abcde";
        String res = resever(s);
        System.out.println(res);
    }


    /**
     * Array = [5 9 3 7 12];
     * 3 5 7 9 12;
     */
    public void sortArray(ArrayList<Integer> arrayList){

    }

    public static void main(String[] args) {
        int[] ints = {5 ,9 ,3 ,7 ,12};
        int n = ints.length;
        for (int i=0; i<n-1; i++){
            for (int j=i+1; j<n; j++){
                if (ints[i] > ints[j]){
                    int temp = ints[j];
                    ints[j] = ints[i];
                    ints[i] = temp;
                }
            }
        }
        System.out.println(Arrays.toString(ints));
    }

}
